package com.sskj.base.socket;

import com.sskj.base.api.Constant;

import org.json.JSONException;
import org.json.JSONObject;

public class MarketWebSocket extends WebSocket {

    private static MarketWebSocket instance;

    public static MarketWebSocket getInstance(String message) {
        JSONObject text = new JSONObject();
        try {
            text.put("code", message);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        if (instance == null) {
            instance = new MarketWebSocket(Constant.MARKET_WS, "market", text.toString());
        } else {
            instance.sendMessage(text.toString());
        }
        return instance;
    }

    protected MarketWebSocket(String url, String tag, String message) {
        super(url, tag, message);
    }

    protected MarketWebSocket(String url, String tag, String message, boolean isSSL) {
        super(url, tag, message, isSSL);
    }
}
